.head สถิติจำนวนผู้ลงทะเบียนในระบบจำแนกตามอำเภอ
.head= "จังหวัด #{@province_name}"
%style
  th {border-bottom:solid #6C99C6 2px;padding-bottom:10px;color:#2175BC}
  td {padding-top:5px; }
%p
%table{:style=>'clear:left;width:100%;margin-top:0px;', :cellspacing=>0}
  %tr
    %th อำเภอ
    %th จำนวนผู้ลงทะเบียน
  - p = params[:province]
  - @amphoes.each do |amphoe|
    - a= amphoe.attributes["amphoe"]
    - next if a.blank?
    - if a =~ /\d{4}/
      - amphoe= Amphoe.find_by_code a
      - amphoe_name= amphoe.th
    - else
      - amphoe_name= a
    - num_users = User.count_by_sql "SELECT COUNT(*) FROM users WHERE amphoe= '#{a}' AND province='#{p}'"
    %tr{:style=>"background-color:#{cycle('#ddd','#fff')};"}
      %td= link_to amphoe_name, :action=>:users_tambon, :amphoe=>a, :province=>p
      %td{:style=>'text-align:right;'}= num_users

%p{:style=>'clear:both; height:20px;'}
